package net.flintx.array;

import java.util.Arrays;

/**
 * Created by flintx on 2018/1/10.
 */
public class ArrayPartitionI {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums, 0, nums.length);
        int sum = 0;
        for (int i = 0; i < nums.length - 1; i += 2) {
            sum += nums[i];
        }
        return sum;
    }
}
